home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Gamma Fade 1.1.2 / Test App / about.c < prev    next >
Text File  |  1993-03-13  |  2KB  |  66 lines

  1. // File "about.c" - Source for the Cool About Box
  2.  
  3. #include "about.h"
  4. #include "gamma.h"
  5.  
  6. // * ****************************************************************************** *
  7.  
  8. void doAboutBox() {
  9.     short done=0, theItem=0, i;
  10.     DialogPtr theDialog;    
  11.  
  12.     SetCursor(&arrow);
  13.  
  14.     if (IsGammaAvailable() == 0) {
  15.         DebugStr("\pTester is unable to do fades on this machine.");
  16.         ExitToShell();
  17.         }
  18.     
  19.     SetupGammaTools();
  20.     for(i=100; i >= 0; i-=5) DoGammaFade(i);
  21.  
  22.     theDialog = GetNewDialog(kAboutBoxDLOG, 0, (WindowPtr) -1);
  23.     ShowWindow(theDialog);
  24.     UpdtDialog(theDialog,theDialog->visRgn);
  25.  
  26.     for(i=0; i <= 100; i+=2) DoOneGammaFade(GetMainDevice(), i);
  27.  
  28.     while(done == 0) {
  29.         ModalDialog(aboutFilterProc, &theItem);
  30.         if (theItem == 1) done = -1;
  31.         }
  32.  
  33.     for(i=100; i >= 0; i-=2) DoOneGammaFade(GetMainDevice(), i);
  34.  
  35.     HideWindow(theDialog);
  36.     DisposeDialog(theDialog);
  37.  
  38.     for(i=0; i <= 100; i+=5) DoGammaFade(i);
  39.     DisposeGammaTools();
  40.     }
  41.  
  42. // * ****************************************************************************** *
  43. // * ****************************************************************************** *
  44.  
  45. pascal Boolean aboutFilterProc(DialogPtr theDialog, EventRecord *theEvent, short *theItem) {
  46.  
  47.     switch(theEvent->what) {
  48.         case mouseDown:
  49.         case keyDown:
  50.         case autoKey:
  51.             *theItem = 1;
  52.             return(kDontPassIt);
  53.             break;
  54.             
  55.         case nullEvent:
  56.         default:
  57.             if (theEvent->modifiers & (cmdKey + optionKey + shiftKey + controlKey)) {
  58.                 *theItem = 1;
  59.                 return(kDontPassIt);
  60.                 }
  61.             break;
  62.         }
  63.  
  64.     return(kPassItOn);
  65.     }
  66.